﻿using System;
using Csla;
using Csla.Serialization;
using BizControl.DalLinq;

namespace BizControl.Library.BusinessObjects.Models
{
  [Serializable()]
  public class ModelInfo : ReadOnlyBase<ModelInfo>, ISupportEmptyValue
  {
    public Guid Id { get; private set; }
    public string Name { get; private set; }

    public override string ToString()
    {
      return Name;
    }

    private ModelInfo()
    { /* require use of factory methods */ }

    internal ModelInfo(Guid id, string name)
    {
      Id = id;
      Name = name;
    }

    internal ModelInfo(Model model)
    {
      Id = model.ModelId;
      Name = model.Name;
    }

    internal ModelInfo(ModelBO model)
    {
      Id = model.ModelId;
      Name = model.Name;
    }

    #region ISupportEmtpyValue Members

    public bool IsEmpty()
    {
      return Id == Guid.Empty;
    }

    #endregion
  }
}
